package com.atguigu.cloud.utils;

import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Component;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@SuppressWarnings("all")
@Component
public class DateUtils {
    public static void main(String[] args) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date date = dateFormat.parse("2025-09-12");
            System.out.println(date);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * 1:当前日期晚于传入日期
     * 0:当前日期等于传入日期
     * -1:当前日期早于传入日期
     * @param presentDate
     * @param date
     * @return
     */
    public int eqDate(Date presentDate,Date date){
        return presentDate.compareTo(date);
    }
}
